package by.onlinernews.settings;

import by.onlinernews.loader.ServiceLoad;
import android.content.Context;
import android.content.Intent;
import android.preference.DialogPreference;
import android.util.AttributeSet;


public class ConfirmDialogPreference extends DialogPreference {
	//String typeAction;
	Context context;

	public ConfirmDialogPreference(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.context = context;
	}
    @Override
    protected void onDialogClosed(boolean positiveResult) {
	super.onDialogClosed(positiveResult);

	// Return if change was cancelled
	if (!positiveResult) {
	    return;
	}

	else {
		context.startService(new Intent(context, ServiceLoad.class).putExtra("target", ServiceLoad.STOP_LOADING_ALL));
		context.startService(new Intent(context, ServiceLoad.class).putExtra("target", ServiceLoad.DELETE_ALL));
		
		
	}
    }
}
